package com.kaifamiao.arrays;

// 多维数组
public class MultipleDimension {
    public static void main(String[] args) {
        char ch = '\u55b5';
        System.out.println( ch );

        char row1[] = { '白', '日', '依', '山', '尽' };
        char row2[] = { '黄', '河', '入', '海', '流' };
        char row3[] = { '欲', '穷', '千', '里', '目'};
        char row4[] = { '更', '上', '一', '层', '楼'};

        char[] rows[] = { row1, row2, row3, row4 };

        for (int i = 0; i < rows.length; i++) {
            // 从 rows 数组中获取下标 i 处的元素 (它也是个数组)
            char[] innerArray = rows[i];
            // 继续使用循环处理内部的数组
            for (int j = 0; j < innerArray.length; j++) {
                char c = innerArray[j];
                System.out.printf( "%ct" , c );
            }
            System.out.println();
        }

        System.out.println( "- ".repeat( 15 ) );

        char[][] gushi = {
            { '青', '海', '长', '云', '暗', '雪', '山' },
            { '孤', '城', '遥', '望', '玉', '门', '关' },
            { '黄', '沙', '百', '战', '穿', '金', '甲' },
            { '不', '破', '楼', '兰', '终', '不', '还'}
        };

        for (int i = 0; i < gushi.length; i++) {
            char[] arr = gushi[i];
            for (int j = 0; j < arr.length; j++) {
                System.out.printf( "%c\t" , arr[j] );
            }
            System.out.println();
        }

        System.out.println( "~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~");

        for (int i = 0; i < gushi.length; i++) {
            for (int j = gushi[i].length - 1 ; j >= 0; j--) {
                System.out.printf( "%c\t" , gushi[i][j] );
            }
            System.out.println();
        }
    }
}
